package com.song.JavaThread_day04.ch4_10;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

public class ExecutableTask implements Callable<String> {

	private String name;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public ExecutableTask(String name) {
		super();
		this.name = name;
	}
	
	
	@Override
	public String call() throws Exception {
		
		long duration =(long)(Math.random() *10);
		System.out.printf(" %s :waiting %d seconds for result \n",this.name , duration);
		TimeUnit.SECONDS.sleep(duration);
		return "hello , world , i'm "+name;
	}

}
